package com.zhongkai.controller;

import com.zhongkai.app.service.RecordService;
import com.zhongkai.model.utils.ZhongkaiResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 库存变动记录单
 * */
@Controller
public class RecordController {

    @Autowired
    private RecordService recordService;



    /**
     *工程库存变动
     */
    @RequestMapping(value = "/record/list", produces = "application/json;charset=utf-8")
    @ResponseBody
    public ZhongkaiResult listRecord(@RequestParam(defaultValue = "0")Integer page, @RequestParam(defaultValue = "0")Integer rows) {

        ZhongkaiResult result = recordService.listRecord(page,rows);

        return result;
    }


    /**
     * 办公库存变动
     */
    @RequestMapping(value = "/record/list2", produces = "application/json;charset=utf-8")
    @ResponseBody
    public ZhongkaiResult listRecord2(@RequestParam(defaultValue = "0")Integer page, @RequestParam(defaultValue = "0")Integer rows) {

        ZhongkaiResult result = recordService.listRecord2(page,rows);

        return result;
    }



    /**
     * 产品库存变动
     */
    @RequestMapping(value = "/record/list3", produces = "application/json;charset=utf-8")
    @ResponseBody
    public ZhongkaiResult listRecord3(@RequestParam(defaultValue = "0")Integer page, @RequestParam(defaultValue = "0")Integer rows) {

        ZhongkaiResult result = recordService.listRecord3(page,rows);

        return result;
    }


    /**
     * 库存操作记录查询
     *
     * @param page 页数
     * @param rows 每页数据条数
     * @param status 类型 //1工程 2办公 3公司产品
     * @param name 操作人员姓名
     * @param time 时间
     */
    @RequestMapping(value = "/record/seek_list", produces = "application/json;charset=utf-8")
    @ResponseBody
    public ZhongkaiResult seekRecord(@RequestParam(defaultValue = "0")Integer page, @RequestParam(defaultValue = "0")Integer rows,
                                     String status,String name, @RequestParam(defaultValue = "0")Long time) {

        ZhongkaiResult result = recordService.seekRecord(page,rows,status,name,time);

        return result;
    }
}
